home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr13
/
aurora2c.zip
/
COUNTWRD.AML
< prev
next >
Wrap
Text File
|
1995-04-07
|
1KB
|
40 lines
// ───────────────────────────────────────────────────────────────────
// The Aurora Editor v2.0
// Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
//
// Word counting macro
//
// Counts the number of words in the current file. The count is
// limited to a marked block if it exists in the current file.
// For this macro, words are defined to be contiguous sequences
// of alphabetic characters (of any case) and the underline (_)
// character.
// ───────────────────────────────────────────────────────────────────
// compile time macros and function definitions
include bootpath "define.aml"
// test for edit windows
if not wintype? "edit" then
msgbox "Edit windows only!"
return
end
// test if a marked block exists in the current file
block_count = mark? and getmarkbuf == getcurrbuf
// display message
say "Counting words" + (if? block_count " in block") + "..."
// count words using regular expression searching
count = find "[a-zA-Z_]#" "axg" + (if? block_count 'b')
// clear the title bar
display
// display the word count
shortbox (if? count (thousands count) "No") + " words found" +
(if? block_count " in the block")